<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>模拟激活用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
    <style>
        .layui-form-label{ width: 102px; }
        .layui-input-block{ margin-left: 152px;}
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card" style="height: 600px;padding-top: 20px;">
        <div class="layui-form">

            <div class="layui-form-item">
                <label class="layui-form-label">投放媒体</label>
                <div class="layui-input-inline" style="width: 340px">
                    <select name="advert_media_id" lay-verify="advert_media_id" lay-verType="tips" lay-filter="advert_media_id">
                        <option value="0"></option>
                        {foreach $advert_medias as $k => $v}
                        <option value="{$k}">{$v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" id="tooltip_step1">用户ID<svg width="16" height="16" viewBox="0 0 24 24" class="dls-icon " focusable="false" font-size="14px" style="vertical-align: -0.225em;"><path d="M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0zm0 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm.054 13.656a1.242 1.242 0 110 2.484 1.242 1.242 0 010-2.484zM12 5.8a3.7 3.7 0 012.373 6.539l-.237.182-.13.088c-.643.473-.956.99-1 1.597L13 14.36h-2c0-1.275.57-2.366 1.64-3.222l.226-.171-.001-.003.149-.1A1.69 1.69 0 0013.7 9.5a1.7 1.7 0 00-3.394-.146L10.3 9.5h-2A3.7 3.7 0 0112 5.8z" fill-rule="evenodd"></path></svg></label>
                <div class="layui-input-inline" style="width: 340px">
                    <input type="text" name="uid" lay-verify="uid" lay-verType="tips" placeholder="请输入App的用户id" autocomplete="off" class="layui-input" />
                    <br>
                    <div class="layui-form-mid layui-word-aux">请填写模拟从【<span class="media_name"></span>】广告进入App的用户ID</div>
                </div>

            </div>

            <!--<div class="layui-form-item" style="padding: 15px; margin-left: 46px;line-height: 25px;">
                <div class="h3">提示：</div>
                <p>1.如上方提示建立好测试计划和创意（务必保证创意用的是竖版视频，计划是打开投放状态）</p>
                <p>2.选择对应广告进行广告预览，在对应媒体端刷到对应的广告，模拟用户行为点击进入App书城</p>
                <p>4.进入书城到"我的"里面获取用户id 填写至上方表单 而后点击尝试激活</p>
                <p><span class="question" id="tooltip_paynum">5.若返回激活成功字样，并在广告自定义列表的付费次数和付费金额看到对应数据则代表激活成功，新计划的转化目标便可以选择付费选项<svg width="16" height="16" viewBox="0 0 24 24" class="dls-icon " focusable="false" font-size="14px" style="vertical-align: -0.225em;"><path d="M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0zm0 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm.054 13.656a1.242 1.242 0 110 2.484 1.242 1.242 0 010-2.484zM12 5.8a3.7 3.7 0 012.373 6.539l-.237.182-.13.088c-.643.473-.956.99-1 1.597L13 14.36h-2c0-1.275.57-2.366 1.64-3.222l.226-.171-.001-.003.149-.1A1.69 1.69 0 0013.7 9.5a1.7 1.7 0 00-3.394-.146L10.3 9.5h-2A3.7 3.7 0 0112 5.8z" fill-rule="evenodd"></path></svg></span></p>
                <p>ps:同一用户可多次模拟激活不同广告账户，但每次激活后需重新从对应的广告计划模拟进入App书城</p>
            </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <button class="layui-btn" lay-submit lay-filter="user_active">提交</button>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form;

        $("#tooltip_step1").hover(function () {
            layer.tips('<p style="padding-top:2px;"><img src="/static/imgs/tip_userid.png" width="216"></p>', this, {
                tips: [1, "#333"],
                time: 80000,
                area: ['236px', '396px'],
            });
        },function () {
            layer.closeAll('tips');
        });

        //查看广告充值次数提示
        $("#tooltip_paynum").hover(function () {
            layer.tips('<p style="padding-top:2px;"><img src="/static/imgs/tip_kspaynum.png"></p>', this, {
                tips: [1, "#333"],
                time: 80000,
                area: ['280px', '252px'],
            });
        },function () {
            layer.closeAll('tips');
        });

        form.on('select(advert_media_id)', function(data){

            if(data.value == 1)
            {
                $('.media_name').html('快手');
            }
            if(data.value == 2)
            {
                $('.media_name').html('巨量');
            }
            if(data.value == 3)
            {
                $('.media_name').html('巨量二跳');
            }

        });

        form.verify({

            advert_media_id: function (value) {
                if(value < 1){
                    return '请选择投放媒体';
                }
            },
            uid: function (value) {
                if(value < 1){
                    return '请输入用户ID';
                }
            },

        });

        form.on('submit(user_active)', function(data){

            $.ajax({
                url:"{:url('Backhaul/manual_active')}",
                type:"post",
                dataType: "json",
                data:data.field,
                async:true,
                success: function(rs){
                    if(rs['code'] == 100){

                        layer.msg(rs['msg'],function () {
                            layer.close(); //关闭弹层
                        });

                    }else{
                        layer.msg(rs['msg']);
                    }
                    return false;
                }
            });
        });

    })

</script>
</body>
</html>